// JavaScript Document
	function setPdfFile(filename){
		$('#FlexPaperViewer').remove();
		$('#flash').append('<div id="flashContent"></div>');
             <!-- For version detection, set to min. required Flash Player version, or 0 (or 0.0.0), for no version detection. -->
        var swfVersionStr = "10.0.0";

        <!-- To use express install, set to playerProductInstall.swf, otherwise the empty string. -->
        var xiSwfUrlStr = "playerProductInstall.swf";

        var flashvars = {
            SwfFile : escape(filename),
            Scale : 0.6,
            ZoomTransition : "easeOut",
            ZoomTime : 0.5,
            ZoomInterval : 0.1,
            FitPageOnLoad : false,
            FitWidthOnLoad : true,
            PrintEnabled : true,
            FullScreenAsMaxWindow : false,
            ProgressiveLoading : true,

            PrintToolsVisible : true,
            ViewModeToolsVisible : true,
            ZoomToolsVisible : true,
            FullScreenVisible : true,
            NavToolsVisible : true,
            CursorToolsVisible : true,
            SearchToolsVisible : true,

            localeChain: "zh_CN"
        };

        var params = {

        }
        params.quality = "high";
        params.bgcolor = "#ffffff";
        params.allowscriptaccess = "sameDomain";
        params.allowfullscreen = "true";
        var attributes = {};
        attributes.id = "FlexPaperViewer";
        attributes.name = "FlexPaperViewer";
        swfobject.embedSWF(
        "FlexPaperViewer.swf", "flashContent",
        "700", "700",
        swfVersionStr, xiSwfUrlStr,
        flashvars, params, attributes);
        swfobject.createCSS("#flashContent", "display:block;text-align:left;");
	}
$(document).ready(function(){
	$('ul ul').remove();	
	
	$('#nav-bar>ul >li').hover(function(){
		//$(this).children('ul').stop();										
		$(this).children('.sub-menu').slideToggle();								
	});
	$('.menu>li').addClass('item');

	$('#sub-menu-content li').live('click',function(event){
		pos=$('.item a').index($('.menu-current'))+1;
		//console.debug(pos);
		$('#sub-menu-content li').removeClass('sub-meunu-current');
		$(this).addClass('sub-meunu-current');
		sub_pos=$('#sub-menu-content li').index($(this));
		path=('doc/'+pos+'/'+(sub_pos+1)+'.swf');
		//console.debug(path);
		setPdfFile(path);
		event.preventDefault();
	});
	
	$('#nav-bar li').live('click',function(event){
		$('#nav-bar li a').removeClass('menu-current');
		$(this).children('a').addClass('menu-current');
		pos=$('.item').index($(this));

		//console.debug(pos);
		if(file_names[pos].length>0){
			html='<ul>';
			$.each(file_names[pos],function(i,v){
				if(v!=null){				
					html+='<li><a href="#">';
					html+=v;
					html+='</a></li>';
				}
				//console.debug(v);
			});
			html+='</ul>';
		}
		else{
			html='';
		}
		$('#sub-menu-header').children().text($(this).text());
		$('#sub-menu-content').children().remove();
		$('#sub-menu-content').append(html).hide().fadeIn();
		$('#sub-menu-content li').eq(0).click();
		event.preventDefault();
	});
	

	
});

